home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 1999 #1 / 1999 CD 1 (black).iso / Fisher-Price / Crane.dcr / scripts_20_chute parent.ls < prev    next >
Encoding:
Text File  |  1998-08-17  |  3.3 KB  |  100 lines

  1. property mysprite, myframes, myframecounter, mycurrframelist, myframerects, myoffrect, mycurrrectlist, mycurrentlook, mypreviouslook, mystate, mytimer, mywait, myframelimit, mymember, myframestart, myH, myV, myhgrid, myvgrid, vmagnification, vposlist, craneratio, leftfactor, topfactor, rightfactor, bottomfactor, hfactor, vfactor, mystarttime, myendtime, myendvalue, mystartvalue, normalmem1, normalmem2, darkmem1, darkmem2, mysprite1, mysprite2
  2.  
  3. on new me, insprite
  4.   global backgroundsprite, gridsprites, backgroundnumber
  5.   set mytimer to 0
  6.   set mywait to 6
  7.   set myH to 900
  8.   set myV to 900
  9.   set mysprite to insprite
  10.   repeat with thesprite = mysprite to mysprite + 3
  11.     puppetSprite(thesprite, 1)
  12.   end repeat
  13.   set vposlist to [208, 230, 252, 275, 296, 319]
  14.   set vmagnification to [0.5, 0.60000000000000009, 0.70000000000000007, 0.80000000000000004, 0.90000000000000002, 1.0]
  15.   set myhgrid to 4
  16.   set myvgrid to 1
  17.   set chutedata to value(field "chute animation info")
  18.   set mycurrentlook to 1
  19.   set mypreviouslook to 1
  20.   set myframes to getaProp(chutedata, backgroundnumber)
  21.   set mycurrframelist to getAt(myframes, mycurrentlook)
  22.   set myframecounter to 1
  23.   set myframelimit to count(mycurrframelist)
  24.   set myframestart to 1
  25.   set myH to ((myhgrid - 1) * 200) + 100
  26.   set myH to the left of sprite backgroundsprite + myH
  27.   set myV to getAt(vposlist, myvgrid)
  28.   set mytimer to 0
  29.   set mywait to 6
  30.   set mystate to #active
  31.   updatemysprites(me)
  32.   return me
  33. end
  34.  
  35. on moveme me, craneresult, cranecommand, backchange
  36.   global cranehgrid, cranevgrid
  37.   case mystate of
  38.     #active:
  39.       set myH to myH + backchange
  40.       if (myhgrid = cranehgrid) and (myvgrid = cranevgrid) then
  41.         set mycurrentlook to 2
  42.       else
  43.         set mycurrentlook to 1
  44.       end if
  45.       updatemysprites(me)
  46.     #flashing:
  47.       set myH to myH + backchange
  48.       if the timer >= myendtime then
  49.         set mystate to #active
  50.         set mycurrentlook to 1
  51.       else
  52.         if the timer >= mystarttime then
  53.           if mycurrentlook = 1 then
  54.             set mycurrentlook to 2
  55.           else
  56.             set mycurrentlook to 1
  57.           end if
  58.           set mystarttime to the timer + 20
  59.         end if
  60.       end if
  61.       updatemysprites(me)
  62.   end case
  63. end
  64.  
  65. on updatemysprites me
  66.   if not (mypreviouslook = mycurrentlook) then
  67.     set mycurrframelist to getAt(myframes, mycurrentlook)
  68.     set myframelimit to count(mycurrframelist)
  69.     set mypreviouslook to mycurrentlook
  70.   end if
  71.   if the timer >= mytimer then
  72.     set myframecounter to myframecounter + 1
  73.     if myframecounter > myframelimit then
  74.       set myframecounter to 1
  75.     end if
  76.     set mytimer to the timer + mywait
  77.   end if
  78.   set curdata to getAt(mycurrframelist, myframecounter)
  79.   set tempcounter to 0
  80.   set curdatacount to count(curdata)
  81.   repeat with mydata in curdata
  82.     set tempcounter to tempcounter + 1
  83.     if not (mydata = []) then
  84.       set thepoint to getAt(mydata, 1)
  85.       set themember to getAt(mydata, 2)
  86.       set whichSprite to mysprite + tempcounter - 1
  87.       set the loc of sprite whichSprite to point(myH, myV) + thepoint
  88.       set the member of sprite whichSprite to themember
  89.       next repeat
  90.     end if
  91.     set the loc of sprite (mysprite + tempcounter - 1) to point(900, 900)
  92.   end repeat
  93. end
  94.  
  95. on flashchute me
  96.   set mystate to #flashing
  97.   set myendtime to the timer + 300
  98.   set mystarttime to the timer + 20
  99. end
  100.